Enhance CMakeLists.txt (#138)
authorNehal J Wani <nehaljw.kkd1@gmail.com>
Wed, 6 Jun 2018 14:16:07 +0000 (19:46 +0530)
committerSteven G. Johnson <stevenj@mit.edu>
Wed, 6 Jun 2018 14:16:07 +0000 (16:16 +0200)
* Change name of static library if building with msvc

* Add install target for cmake

CMakeLists.txt

index a255b5b687c5702c92649f47f20bf20fbf08e624..e0d3f3f0b25412f1c114bfff1251bbf225edfe27 100644 (file)
@@ -27,6 +27,9 @@ if (BUILD_SHARED_LIBS)
 else()
   # Building static library
   target_compile_definitions(utf8proc PUBLIC "UTF8PROC_STATIC")
+  if (MSVC)
+    set_target_properties(utf8proc PROPERTIES OUTPUT_NAME "utf8proc_static")
+  endif()
 endif()
 
 target_compile_definitions(utf8proc PRIVATE "UTF8PROC_EXPORTS")
@@ -36,3 +39,13 @@ set_target_properties (utf8proc PROPERTIES
   VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}"
   SOVERSION ${SO_MAJOR}
 )
+
+install(TARGETS utf8proc
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib)
+
+install(
+  FILES
+    "${PROJECT_SOURCE_DIR}/utf8proc.h"
+  DESTINATION include)